

    /******************
    ****2018-3-21新增举报功能模块******
    ******************/
    var type_a = '';
    var id_a = '';
    var plat_id_a = '';
    var hr=''
        hr+='<div class="report_form">'
        hr+='<div class="report_title">举报</div>'
        hr+='<ul>'
        hr+='<li onclick="chose_list(this,1)" attr="0"><span>淫秽色情</span>     <h4  style="display: none">撤销</h4></li>'
        hr+='<li onclick="chose_list(this,1)" attr="0"><span>违法信息</span>     <h4  style="display: none">撤销</h4></li>'
        hr+='<li onclick="chose_list(this,1)" attr="0"><span>营销广告</span>     <h4  style="display: none">撤销</h4></li>'
        hr+='<li onclick="chose_list(this,1)" attr="0"><span>恶意攻击谩骂</span> <h4  style="display: none">撤销</h4></li>'
        hr+='</ul>'
        hr+='<div class="textarea_title"> 我有话要说</div>'
        hr+='<textarea name="content" class="more_report" placeholder="请输入您要举报的原因，我们会尽快给你反馈."></textarea>';
        hr+='<div onclick="sub()" class="sub_report">提交</div></div>';
  function report(type,id,plat_id){
     var href  = window.location.href
     var href = href.replace('http://new.wx8hj.local', ' ');
        $.ajax({
            url: '/Home/Person/check_report',
            type: 'POST',
            dataType: 'json',
            success: function(res) {
                if(res.err==0) {
                       //页面层
                      layer.open({
                        type: 1
                        ,content: hr
                        ,anim: 'up'
                        ,style: 'position:fixed; bottom:0; left:0; width: 100%; height: 13.74rem; padding:0px 0; border:none;'
                      });
                      type_a = type;
                      id_a = id;
                      plat_id_a = plat_id;
                } else {
                    location.href = "/Home/User/login?callback="+href;
                }
            }
        });

  }

  function sub() {
        type = type_a;
        type_id = id_a;
        id = plat_id_a
        var option = Array();
        var content = $('textarea[name="content"]').val();
        $('.report_form').find('li').each(function(i,v){
            if($(this).attr('attr')==1) {
                 var val = $(v).find('span').text()
                  var val = val.replace('已举报', ' ');
                  option.push(val)

            }
            //console.log(option)
        });
        if(option) {
            $.post("/Home/Person/report",{type:type,type_id:type_id,option:option,content:content},function(res) {
                if(res.err==2) {
                    layer.open({
                        content: '请先登录！'
                        , skin: 'msg'
                        , time: 1
                        , end: function () {
                            location.href = "/Home/User/login?callback=/Home/Person/my_circle/id/"+id
                        }
                    });
                } else {
                    //layer.open({type: 5,content: res.msg});
                    //layer.close({type: 5,content: res.msg});
                    layer.open({
                                content: res.msg
                                , skin: 'msg'
                                , time: 2
                                , end: function () {
                                    layer.closeAll()
                                }
                    });
                }
            });
        } else {
            layer.open({type: 5,content: "举报内容不能为空"});
        }
  }

    function chose_list(obj,val){
      if(val==1){
        var title = $(obj).find('span').text();
        $(obj).find('span').css({color:'#999999'});
        $(obj).find('span').text("已举报"+title);
        $(obj).find('h4').show();
        $(obj).attr('attr',1);
        $(obj).attr('onclick','chose_list(this,0)');
      }else{
        var title = $(obj).find('span').text();
        var title = title.replace('已举报', ' ');
        $(obj).find('span').css({color:'#000'});
        $(obj).find('span').text(title);
        $(obj).find('h4').hide();
        $(obj).attr('attr',0);
        $(obj).attr('onclick','chose_list(this,1)');

      }
    }
        window.onload = function () {
        var topSwiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        autoplayDisableOnInteraction: false,
        direction: 'horizontal',
        paginationClickable: true,
        slideToClickedSlide: true,
        loop: false,
        slidesPerView: 4.5,
      //  autoplay: 2000
    });
  }

